Comment: Native Code Setup Engine 32 bit-64 bit Installer Project
Comment: Set Variable CMDLINE to bla=45 lslsl /32 ll=a
Set Variable SHORTTITLE to Spatial Workshop
Set Variable FULLTITLE to $SHORTTITLE$ 2013 #SUITEMODE# (V#USERVERSION#)
Set Variable UITITLE to $SHORTTITLE$ 2013 #SUITEMODE#
 
Set Variable MYAH_DISABLE_VISTA_RESTART_MANAGER to FALSE
Set Variable MYAH_DISABLE_ROLLBACK to FALSE
Set Variable NATIVE_OVERWRITE_OLDER to FALSE
Set Variable NATIVE_OVERWRITE to PROMPT
Set Variable NATIVE_ERROR to PROMPT
Set Variable DELAYUNTIL_APPLYCHANGES to FALSE
Set Variable SILENT to FALSE
Set Variable SAVEDATA to FALSE
Set Variable MYAHLOGO to TRUE
Set Variable MYAH_TIMEOUT to 10
Set Variable MYAH_COMPRESS_INSTALLER_CACHE to TRUE
Set Variable LOADOLDDATA to FALSE
Set Variable ABORTONERROR to TRUE
 
[DEFINE REGION: Check Application Requirements]
Get System Setting Administrator Rights into CHECKSYSTEM
if Variable CHECKSYSTEM not Equals TRUE
  MessageBox: $TITLE$ Setup Error, This product requires at least Administrator Privileges.$NEWLINE$$NEWLINE$Setup cannot continue.
  Terminate Installation
end
Comment: Check system has at least Windows 98
Get System Setting Windows XP into CHECKSYSTEM
if Variable CHECKSYSTEM not Equals TRUE
  MessageBox: $TITLE$ Setup Error, This product requires at least Windows XP.$NEWLINE$$NEWLINE$Setup cannot continue.
  Terminate Installation
end
 
Comment: Check system has at least Internet Explorer 5.01 Service Pack 1
 
[END REGION]
 
[DEFINE REGION: Determine Architecture]
Get System Setting Windows in 64 bit Mode into IS64BIT
Write into Text File $LOGGED$ from Value Windows is 64-bit=$IS64BIT$ (at end of file)
if Variable RUN64BIT not is Defined 
  Set Persistent Variable RUN64BIT to $IS64BIT$
  if Variable CMDLINE Contains /32 
    Write into Text File $LOGGED$ from Value Commandline forces 32-bit installation (at end of file)
    Set Persistent Variable RUN64BIT to FALSE
  end
end
[END REGION]
 
[DEFINE REGION: Check/Install Application Pre-Requisites]
 
[DEFINE REGION: Check Application Pre-Requisites]
Comment: Check setup pre-requisites
Set Variable PREREQ to FALSE
Set Variable PRELIST to 
[compiler if Variable BUILDMODE not Equals PATCH]
if Variable NEEDSUPGRADE Equals TRUE
  Comment: Uninstall via Windows Installer
  Set Variable PREREQ to TRUE
  Set Variable PRELIST to $PRELIST$$NEWLINE$Previous Version Uninstallation
end
Include Script: checkmsi31
if Variable IS64BIT Equals TRUE
  Include Script: checknet4aip_client_x64
  Include Script: checknet4aip_x64
else
  Include Script: checknet4aip_client_x86
  Include Script: checknet4aip_x86
end
if Variable RUN64BIT Equals TRUE
  GoTo Label: vcx64check
end
Include Script: checkvc10_x86
GoTo Label: cont
label: vcx64check
Include Script: checkvc10_x64
label: cont
if Variable RECOMMENDEDUPGRADE Equals TRUE
  Comment: Uninstall via Native Engine
  Set Variable PREREQ to TRUE
  Set Variable PRELIST to $PRELIST$$NEWLINE$Previous Version Removal
end
[compiler end]
[END REGION]
 
[DEFINE REGION: Set Installer Mode]
if Variable RUN64BIT Equals TRUE
  Set Variable DIALOGTITLE to $TITLE$ Installation - 64-bit
  Set x64 - Native 64 bit Windows, AMD64 and EM64T Architectures - installation mode
else
  Set Variable DIALOGTITLE to $TITLE$ Installation - 32-bit
  Set Win32 - Native 32 bit Windows and Windows 32 on Windows 64 (WOW64) - installation mode
end
[END REGION]
 
[DEFINE REGION: Install Application Pre-Requisites]
Comment: Install setup pre-requisites
if Variable PREREQ not Equals FALSE
  Display Dialog: prereq, wait for dialog to return (modal)
  if Variable WIZARD Equals CANCEL
    Terminate Installation
  end
  Display Dialog: progressprereq, use as progress dialog (non-modal)
  [compiler if Variable BUILDMODE not Equals PATCH]
  if Variable NEEDSUPGRADE Equals TRUE
    Set Variable REMOVEOLD to 
    Set Variable ERROROLD to 
    Read Registry Key HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$PRODUCTCODE$\DisplayName into MYOLDAPP
    Install/Remove MSI Package $PRODUCTCODE$[REMOVE=ALL] (get result into variable REMOVEOLD)
    if Variable REMOVEOLD Equals ERROR
      MessageBox: $TITLE$ Setup, Unable to uninstall old version of $TITLE$. Please uninstall it yourself using Control Panel Add-Remove Programs before attempting to install this product.$NEWLINE$$NEWLINE$$ERROROLD$
      Terminate Installation
    end
    if Variable REMOVEOLD Equals REBOOT
      MessageBox: $TITLE$ Setup, Your computer needs to be restarted before $TITLE$ Setup can continue.$NEWLINE$$NEWLINE$Please save your work in all running programs and click OK to restart your computer. Setup will resume once your computer restarts.$NEWLINE$$NEWLINE$If you click CANCEL, setup will exit. You will have to run setup again at a later time to install $TITLE$.
      if Variable REBOOTNOW Equals OK
        Reboot Computer and Resume Setup
      else
        Terminate Installation
      end
    end
    Delete Registry KEY HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$MYOLDAPP$\*.*
    Set Variable MAINTENANCE to FALSE
  end
  [DEFINE WEB MEDIA Microsoft Visual C++ Runtime 10.0 (includes ATL and MFC) (x64)]
  Include Script: setupvc10_x64
  [DEFINE WEB MEDIA Microsoft Visual C++ Runtime 10.0 (includes ATL and MFC)]
  Include Script: setupvc10_x86
  [DEFINE WEB MEDIA Microsoft Windows Installer 3.1]
  Include Script: setupmsi31
  [DEFINE WEB MEDIA Microsoft .NET Framework Client 4]
  Include Script: setupnet4aip_client_x86
  [DEFINE WEB MEDIA Microsoft .NET Framework 4]
  Include Script: setupnet4aip_x86
  [DEFINE WEB MEDIA Microsoft .NET Framework Client 4 (x64)]
  Include Script: setupnet4aip_client_x64
  [DEFINE WEB MEDIA Microsoft .NET Framework 4 (x64)]
  Include Script: setupnet4aip_x64
  if Variable RECOMMENDEDUPGRADE Equals TRUE
    Comment: Bind to external setup log
    Set Variable NATIVE_LOGGING to $NATIVE_OLDLOG$
    Set Variable NATIVE_ENGINE_MODE to $NATIVE_ENGINE$
    Set Variable NATIVE_ENGINE to TRUE
    Apply Uninstall (get result into variable NATIVE_UNINSTALL)
    Set Variable NATIVE_ENGINE to $NATIVE_ENGINE_MODE$
    if Variable NATIVE_UNINSTALL Equals REBOOT
      MessageBox: $TITLE$ Setup, Your computer needs to be restarted before $TITLE$ Setup can continue.$NEWLINE$$NEWLINE$Please save your work in all running programs and click OK to restart your computer. Setup will resume once your computer restarts.$NEWLINE$$NEWLINE$If you click CANCEL, setup will exit. You will have to run setup again at a later time to install $TITLE$.
      if Variable REBOOTNOW Equals OK
        Reboot Computer and Resume Setup
      else
        Terminate Installation
      end
    else
      if Variable NATIVE_UNINSTALL not Equals COMPLETE
        MessageBox: $TITLE$ Setup, Unable to uninstall old version of $TITLE$. It is strongly recommended that you uninstall it yourself using Control Panel Add-Remove Programs before attempting to install this product.$NEWLINE$$NEWLINE$$LASTERROR$$NEWLINE$$NEWLINE$Click OK to quit $TITLE$ Setup.$NEWLINE$$NEWLINE$Click Cancel to continue $TITLE$ Setup anyways (not recommended).
        if Variable NATIVE_ERROR Equals OK
          Terminate Installation
        end
      end
    end
    Comment: Bind to internal setup log
    Set Variable NATIVE_LOGGING to 
  end
  [compiler end]
  Hide Dialog
end
[END REGION]
 
[END REGION]
 
[DEFINE REGION: Define Setup Globals]
Comment: Define Setup Components
Define Component: Spatial Workshop
 
Comment: Initialize Setup Globals
Get System Setting Windows NT Kernel (NT4, 2000, XP, 2003, Vista, 2008, 7, 2008 R2, 8, 2012) into ISNT
Get System Setting Windows 7 into ISWIN7
Get System Setting Windows 8 into ISWIN8
Get Folder Location System->Profiles Directory into PROGRAMFILES
Get Common Folder Location System->Profiles Directory into COMMONFILES
Get Common Folder Location Start Menu->Start Menu Group into SHORTCUTFILESALL
Get Common Folder Location Start Menu->Start Menu Group into SHORTCUTFILES
Set Variable CREATESHORTCUT to TRUE
Set Variable PINTOSTARTSCREEN to FALSE
Set Variable PINTOTASKBAR to FALSE
if Variable ISWIN7 Equals TRUE
  Set Variable PINTOTASKBAR to TRUE
  Set Variable CREATESHORTCUT to FALSE
end
if Variable ISWIN8 Equals TRUE
  Set Variable PINTOSTARTSCREEN to TRUE
  Set Variable CREATESHORTCUT to FALSE
end
if Variable SHORTCUTFILESALL Equals 
  Set Variable SHORTCUTFILESALL to $SHORTCUTFILES$
end
Get Common Folder Location System->CD Burning Directory into DESKTOPDIR
Get Folder Location System->Templates Directory into WINDIR
Get Folder Location System->Send To Directory into WINSYSDIR
Get Common Folder Location System->Windows Directory into QUICKLAUNCHDIR
[END REGION]
 
[DEFINE REGION: Setup User Interview]
if Variable MAINTENANCE Equals TRUE
  GoTo Label: Maintenance
else
  [compiler if Variable BUILDMODE not Equals PATCH]
  Comment: First Time Install
  Set Variable TARGETDIR to $PROGRAMFILES$Spatial Eye
  Set Variable STARTMENU to $FULLTITLE$
  Set Variable NATIVE_ENGINE to TRUE
  [compiler end]
end
 
label: Welcome Dialog
Display Dialog: welcome, wait for dialog to return (modal)
if Variable WIZARD Equals CANCEL
  GoTo Label: Main Install
end
[compiler if Variable BUILDMODE not Equals PATCH]
label: License Check
Display Dialog: licensecheck, wait for dialog to return (modal)
if Variable WIZARD Equals BACK
  GoTo Label: Welcome Dialog
else
  if Variable WIZARD Equals CANCEL
    GoTo Label: Main Install
  end
end
label: User Registration
Display Dialog: registration, wait for dialog to return (modal)
if Variable WIZARD Equals BACK
  GoTo Label: License Check
else
  if Variable WIZARD Equals CANCEL
    GoTo Label: Main Install
  end
end
label: Destination Directory
Display Dialog: destination, wait for dialog to return (modal)
if Variable WIZARD Equals BACK
  GoTo Label: User Registration
else
  if Variable WIZARD Equals CANCEL
    GoTo Label: Main Install
  end
end
label: Start Menu
Display Dialog: startmenu, wait for dialog to return (modal)
if Variable WIZARD Equals BACK
  GoTo Label: Destination Directory
else
  if Variable WIZARD Equals CANCEL
    GoTo Label: Main Install
  end
end
[compiler end]
label: Start Installation
Display Dialog: startinstallation, wait for dialog to return (modal)
if Variable WIZARD Equals BACK
  [compiler if Variable BUILDMODE not Equals PATCH]
  GoTo Label: Start Menu
  [compiler else]
  GoTo Label: Welcome Dialog
  [compiler end]
else
  GoTo Label: Main Install
end
 
label: Maintenance
Comment: Maintenance Install/Uninstall
wizard loop
Display Dialog: maintenance, wait for dialog to return (modal)
end
[END REGION]
 
[DEFINE REGION: Process (Un)Installation]
label: Main Install
Comment: Exit Setup if Wizard Loop cancelled
if Variable WIZARD Equals CANCEL
  Terminate Installation
end
 
Comment: Prepare to install
Set Variable PROGRESSTEXT to Installing $TITLE$
Set Variable SUCCESS to 
Set Variable LASTERROR to 
if Variable ALLUSERS Equals TRUE
  Set Variable SHORTCUTFOLDER to $SHORTCUTFILESALL$\$STARTMENU$
else
  Set Variable SHORTCUTFOLDER to $SHORTCUTFILES$\$STARTMENU$
end
Display Dialog: progress, use as progress dialog (non-modal)
 
Comment: Modify Target System
[DEFINE REGION: Perform Uninstallation]
if Variable REMOVE Equals TRUE
  Comment: Uninstall product
  Comment: TO-DO: Insert any additional uninstall commands here
  Comment: Remove possbible assemblies from the gac
  Does File Exist $TARGETDIR$\$TITLE$\uninstalldll.cmd (get result into variable GACINSTALL)
  if Variable GACINSTALL Equals TRUE
    Set Variable PROGRESSTEXT to Removing GAC Assemblies
    Set Variable PROGRESSMODE to MARQUEE
    Run Program $TARGETDIR$\$TITLE$\uninstalldll.cmd #SUITEMODE# #NEWVERSION#, startup in folder $TARGETDIR$\$TITLE$ (WAIT)
    Set Variable PROGRESSMODE to 
  end
  Apply Uninstall (get result into variable SUCCESS)
  if Variable SUCCESS not Equals ERROR
    if Variable SUCCESS not Equals CANCEL
    end
  end
  Set Variable PROGRESS to 100
else
  [END REGION]
  [DEFINE REGION: Perform First Time or Maintenance Installation]
  Comment: Install/Re-Install product
  [OFFLINE CONTENT]
  Install Files #INPUTPATH#\Shared\*.* to $TARGETDIR$\$TITLE$\, include subfolders
  if Variable RUN64BIT Equals TRUE
    Install Files #INPUTPATH#\x64\*.* to $TARGETDIR$\$TITLE$\, include subfolders
  else
    Install Files #INPUTPATH#\x86\*.* to $TARGETDIR$\$TITLE$\, include subfolders
  end
  if Variable PINTOSTARTSCREEN Equals TRUE
    Create Shortcut $SHORTCUTFOLDER$\$FULLTITLE$ to $TARGETDIR$\$TITLE$\SpatialWorkshop.exe, Pin to Start Screen
  else
    if Variable PINTOTASKBAR Equals TRUE
      Create Shortcut $SHORTCUTFOLDER$\$FULLTITLE$ to $TARGETDIR$\$TITLE$\SpatialWorkshop.exe, Pin to Taskbar, do not include in Start Screen
    end
    Create Shortcut $SHORTCUTFOLDER$\$UITITLE$ to $TARGETDIR$\$TITLE$\SpatialWorkshop.exe, do not include in Start Screen
  end
  if Variable CREATESHORTCUT Equals TRUE
    Create Shortcut $DESKTOPDIR$\$FULLTITLE$ to $TARGETDIR$\$TITLE$\SpatialWorkshop.exe, do not include in Start Screen, disable user pinning
  end
  Write Registry Key HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$TITLE$\\NoModify, 1
  Write Registry Key HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$TITLE$\\NoRepair, 1
  Write Registry Key HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$TITLE$\\DisplayVersion, #NEWVERSION#
  Write Registry Key HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$TITLE$\\RegCompany, $USERCOMPANY$
  Write Registry Key HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$TITLE$\\RegOwner, $USERNAME$
  Install Files #PROJDIR#\Eula.rtf to $TARGETDIR$\$TITLE$\, include subfolders
  [DEFINE WEB MEDIA Spatial Workshop, Exclude from Build]
  Get Component Spatial Workshop Selection State into Variable SELECTED
  if Variable SELECTED Equals TRUE
  end
  Comment: TO-DO: Insert any additional install commands here
  [compiler if Variable BUILDMODE Equals PATCH]
  Apply Patch (get result into variable SUCCESS)
  [compiler else]
  if Variable ADVERTISE Equals TRUE
    Apply Advertised (get result into variable SUCCESS)
  else
    Create File Type $SHORTTITLE$ Project with extensions .SEPROJECT and associate with program $TARGETDIR$\$TITLE$\SpatialWorkshop.exe
    Create File Type $SHORTTITLE$ Style Library with extensions .SESTYLES and associate with program $TARGETDIR$\$TITLE$\SpatialWorkshop.exe
    Create File Type $SHORTTITLE$ Data File with extensions .SEDATA and associate with program $TARGETDIR$\$TITLE$\SpatialWorkshop.exe
    Create Shortcut $SHORTCUTFOLDER$\Help to $TARGETDIR$\$TITLE$\Spatial Workshop 2013.chm, do not highlight in Start Menu, do not include in Start Screen, disable user pinning
    Create Shortcut $SHORTCUTFOLDER$\Tools\Project File Translator to $TARGETDIR$\$TITLE$\ProjectTranslator.exe, do not highlight in Start Menu, do not include in Start Screen, disable user pinning
    Create Shortcut $SHORTCUTFOLDER$\Tools\Style Library Generator to $TARGETDIR$\$TITLE$\StyleLibraryGenerator.exe, do not highlight in Start Menu, do not include in Start Screen, disable user pinning
    Apply Install (get result into variable SUCCESS)
    if Variable SUCCESS not Equals ERROR
      if Variable SUCCESS not Equals CANCEL
        Comment: Install Assemblies into gac if command is available
        Does File Exist $TARGETDIR$\$TITLE$\installdll.cmd (get result into variable GACINSTALL)
        if Variable GACINSTALL Equals TRUE
          Set Variable PROGRESSTEXT to Installing GAC Assemblies
          Set Variable PROGRESSMODE to MARQUEE
          Run Program $TARGETDIR$\$TITLE$\installdll.cmd #SUITEMODE# #NEWVERSION#, startup in folder $TARGETDIR$\$TITLE$ (WAIT)
        end
        Run Program $SUPPORTDIR$\InstallationHelper.exe "SYS" "Spatial Eye" "$TITLE$" "#SUITEMODE#"
      end
    end
  end
  [compiler end]
  Set Variable PROGRESS to 100
end
[END REGION]
[END REGION]
 
[DEFINE REGION: Finish Setup]
Comment: End of Installation
Hide Dialog
Set Variable RUNAPP to False
Display Dialog: finish, wait for dialog to return (modal)
if Variable SILENT Equals FALSE
  if Variable REBOOTCOMPUTER Equals TRUE
    if Variable SUCCESS Equals REBOOT
      Reboot Computer
    end
  end
  if Variable RUNAPP Equals TRUE
    if Variable REMOVE Equals FALSE
      if Variable SUCCESS Equals COMPLETE
        Set Variable INSTALLDIR to $TARGETDIR$\$TITLE$
        Convert to Short Path: INSTALLDIR 
        Call DLL Function kernel32.dll->SetCurrentDirectoryA (get result into variable LASTERROR)
        Run Program $INSTALLDIR$\SpatialWorkshop.exe 
        Comment: TO-DO: Insert command that starts your application here
      end
    end
  end
end
[END REGION]
 
